<template>
	<view class="container">
		<!-- 项目大事件详情 -->
		<view class="top">
			<view class="name">
				<text>{{progressData.partName}}</text>
			</view>
			<view class="time">
				<text>拍摄者：{{progressData.photographer}}·{{progressData.startTime}}</text>
			</view>
		</view>
		<view class="base-card">
			<u-cell-group>
				<u-cell size="normal" title="目标位置" :value="progressData.estateLocation"
					v-if="progressData.estateLocation != null">
				</u-cell>
				<u-cell size="normal" title="开工时间" :value="progressData.startTime">
				</u-cell>
				<u-cell size="normal" title="结工时间" :value="progressData.endTime">
				</u-cell>
				<u-cell size="normal" title="反馈描述" :border="false"></u-cell>
				<view class="pixs">
					<textarea style="padding-left:30rpx ;" :value="progressData.feedBack" placeholder="请描述问题，最多输入200个字"
						disabled />
				</view>
				<u-cell size="normal" title="现场情况" :border="false"></u-cell>
				<view class="pixs">
					<view v-for="(img,i) in progressData.pixs">
						<image :src="getSrc(img)" class="pix" @tap="previewImage(i)"></image>
					</view>
				</view>
			</u-cell-group>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				progressData: {},
				loading: false,
				temp: {},
				_para: ''
			};
		},
		methods: {
			//预览轮播图
			previewImage: function(index) {
				let pixSrcs = []
				for (let i = 0; i < this.progressData.pixs.length; i++) {
					let element = this.getSrc(this.progressData.pixs[i])
					pixSrcs.push(element)
				}
				//uniapp预览轮播图
				uni.previewImage({
					current: index, //预览图片的下标
					urls: pixSrcs //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				})
			},
			getSrc(id) {
				if ((typeof id) != undefined && id != '') {
					let _src = uni.$http.baseURL + '/file/download?fileId=' + id
					return _src
				}
			},
			onLoad(params) {
				this._para = params.item
				let temp = JSON.parse(decodeURIComponent(params.item))
				this.title = temp.title
				this.progressData = temp
				this.progressData.pixs = temp.imgs.split(',')
				console.log(this.progressData)
				if (this.progressData.estateLocation != null) {

				} else {
					this.progressData.estateLocation = null

				}
				// this.getProgressDetails(temp.progressId)
				console.log(temp)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		display: flex;
		flex-direction: column;
		// justify-content: center;
		// align-items: center;
		padding: 30rpx;

		.top {
			display: flex;
			flex-direction: row;
			justify-content: space-between;

			.name {
				font-size: 28rpx;
				font-weight: bold;
				color: #333333;
			}

			.time {
				font-size: 24rpx;
				font-weight: 500;
				color: #333333;
			}
		}

		.base-card {
			border-radius: 20rpx;
			border: 1rpx solid #efefef;
			background-color: #FFFFFF;
			margin-top: 20rpx;
			margin-left: 30rpx;

			textarea {
				margin: 20rpx;
			}

			.pixs {
				display: flex;
				flex-wrap: wrap;
				margin-top: 20rpx;

				// justify-content: space-around;
				.pix {
					width: 200rpx;
					height: 200rpx;
					margin-right: 10rpx;
					margin-bottom: 20rpx;
				}
			}

			.progress-boxs {
				display: flex;
				flex-direction: column;
				align-content: space-around;
				font-size: 24rpx;
				font-weight: 500;
				color: #333333;

				.progress-box {
					margin-top: 30rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;

					progress {
						width: 444rpx;
					}
				}
			}
		}
	}
</style>
